-- @owner: @zou_jialiang050
-- @date: 2022-09-09
-- @testpoint: 表名大小写敏感 create trigger
-- @modify: modified by zhangbingliang at 2025/03/01 根据最新代码优化用例
--step1：create table；expect：创建成功
set dolphin.lower_case_table_names=0;
drop table if exists T_LETTER_0013_01;
create table T_LETTER_0013_01 
(col1 int
,col2 int);
drop table if exists T_LETTER_0013_02;
create table T_LETTER_0013_02 
(col1 int
,col2 int);

--step2：创建触发器函数；expect：成功
drop function if exists func_insert_0013;
create or replace function func_insert_0013() returns trigger as
	$$
	declare
	begin
	   insert into T_LETTER_0013_02 values(new.col1, new.col2);
	   return new;
	end
	$$ language plpgsql;
/

--step3：创建触发器；expect：成功
drop trigger if exists trigger_insert_0013 on T_LETTER_0013_01;
create trigger trigger_insert_0013
	before insert on T_LETTER_0013_01
	for each row
	execute procedure func_insert_0013();
/

--step4：insert插入数据；expect：成功
insert into T_LETTER_0013_01 values(5,10),(15,20),(25,30),(35,40),(45,50);

--step5：查看触发结果；expect：成功
select * from T_LETTER_0013_01;
select * from T_LETTER_0013_02;

--step6：清理环境；expect：成功
drop trigger if exists trigger_insert_0013 on T_LETTER_0013_01;
drop function if exists func_insert_0013;
drop table if exists T_LETTER_0013_02;
drop table if exists T_LETTER_0013_01;
reset dolphin.lower_case_table_names;
